package io.xxx.omni.oss.client

import io.xxx.omni.oss.domain.Platform
import io.xxx.omni.oss.domain.Store
import org.springframework.cloud.openfeign.FeignClient
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.RequestParam

@FeignClient("mdc")
interface PlatformClient {

    @GetMapping("/platforms")
    fun getAll(): List<Platform>

    @GetMapping("/platforms/{id}")
    fun getOne(@PathVariable("id") id: String): Platform?
}

@FeignClient("mdc")
interface StoreClient {

    @GetMapping("/stores")
    fun getAll(@RequestParam("pid") pid: String? = null): List<Store>

    /**
     * 返回的门店信息默认包含平台信息。
     * @param fully 是否包含平台信息，true - 包含，false - 不包含
     */
    @GetMapping("/stores/{id}")
    fun getOne(@PathVariable("id") id: String, @RequestParam("fully") fully: Boolean = true): Store?
}